#ifndef MANAGE_PAGE_H
#define MANAGE_PAGE_H

#include <QWidget>
#include <QVector>
#include <QStandardItemModel>
#include <QUrl>

namespace Ui {
class manage_page;
}

class manage_page : public QWidget
{
    Q_OBJECT

public:
    explicit manage_page(QWidget *parent = nullptr);
    ~manage_page();
    bool addNewItem(QList<QStandardItem *> rowItems);

private:
    Ui::manage_page *ui;
    void initUI();
    void update_table(QVector<QVector<QString>> tabels);
    void showTextbookTable();
    QStandardItemModel *tableModel;

    void sendJsonToServer(const QJsonArray &jsonArray, const QUrl url);
    QJsonArray getJsonDataFromTableView();


private slots:
    void clickedSearchBtn();
    void onTableBtnClicked();
    bool deleteSelectedItem();
    void saveAllToDB();

};


#endif // MANAGE_PAGE_H
